//
//  JWTCourseTableViewCell.m
//  JWT
//
//  Created by ndm on 17/2/9.
//  Copyright © 2017年 com.jwtsoft. All rights reserved.
//

#import "JWTCourseTableViewCell.h"

@implementation JWTCourseTableViewCell

-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self){
        CGFloat shadow_height = 42;
        _courseImageView = [[UIImageView alloc] initWithFrame:CGRectMake(Cell_Margin, Cell_Margin, UISCREEN_WIDTH-2*Cell_Margin, UISCREEN_WIDTH*0.4)];
        [_courseImageView setImage:[UIImage imageNamed:ImageViewDefault]];
        _courseImageView.contentMode = UIViewContentModeScaleAspectFit;
        [self addSubview:_courseImageView];
        
        _shadowImageView = [[UIImageView alloc] initWithFrame:CGRectMake(Cell_Margin,  _courseImageView.bottom-shadow_height,_courseImageView.width, shadow_height)];
        _shadowImageView.backgroundColor = RGBA(0, 0, 0, 0.23);
//        [_shadowImageView setImage:[UIImage imageNamed:@"shadow_title"]];
        [self addSubview:_shadowImageView];
        
        _courseNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(_shadowImageView.left+Cell_Margin, _shadowImageView.top+Cell_Margin*0.5, (_shadowImageView.width-2*Cell_Margin)*0.7, (shadow_height-Cell_Margin)*0.5)];
        _courseNameLabel.text = @"";
        _courseNameLabel.textColor = RGB_WhiteBackGround;
        _courseNameLabel.font = Text_Font14;
        [self addSubview:_courseNameLabel];
        
        _coachNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(_courseNameLabel.left, _courseNameLabel.bottom, _courseNameLabel.width, _courseNameLabel.height)];
        _coachNameLabel.font = Text_Font12;
        _coachNameLabel.text = @"";
        _coachNameLabel.textColor = RGB_WhiteBackGround;
        [self addSubview:_coachNameLabel];
        
        _coursePriceLabel = [[UILabel alloc] initWithFrame:CGRectMake(_courseNameLabel.right, _courseNameLabel.top, (_shadowImageView.width-2*Cell_Margin)*0.3, _courseNameLabel.height)];
        _coursePriceLabel.font = Text_Font14;
        _coursePriceLabel.text = @"";
        _coursePriceLabel.textColor = RGB_WhiteBackGround;
        _coursePriceLabel.textAlignment = NSTextAlignmentCenter;
        [self addSubview:_coursePriceLabel];
        
        
        _coursePersonLabel = [[UILabel alloc] initWithFrame:CGRectMake(_coachNameLabel.right, _coachNameLabel.top, _coursePriceLabel.width, _coursePriceLabel.height)];
        _coursePersonLabel.textAlignment = NSTextAlignmentCenter;
        _coursePersonLabel.font = Text_Font10;
        _coursePersonLabel.textColor = RGB_WhiteBackGround;
        _coursePersonLabel.text = @"";
        [self addSubview:_coursePersonLabel];
        
        _courseTimeLabel = [[UILabel alloc] initWithFrame:CGRectMake(_courseImageView.left, _courseImageView.bottom, (UISCREEN_WIDTH-2*Cell_Margin)*0.6, 34)];
        _courseTimeLabel.font = Text_Font12;
        _courseTimeLabel.text = @"";
        [self addSubview:_courseTimeLabel];
        
        _courseStateLabel = [[UILabel alloc] initWithFrame:CGRectMake(0,self.top+Cell_Margin, (UISCREEN_WIDTH-4*Cell_Margin)*0.23, 24)];
        _courseStateLabel.font = Text_Font14;
        _courseStateLabel.backgroundColor = RGB_LightGray;
        _courseStateLabel.text = @"未开始...";
        _courseStateLabel.textColor = RGB_WhiteBackGround;
        _courseStateLabel.textAlignment = NSTextAlignmentCenter;
        [self addSubview:_courseStateLabel];
        
        self.frame = CGRectMake(self.left, self.top, UISCREEN_WIDTH, _courseTimeLabel.bottom);
        
    }
    
    return self;
}


@end
